using System;
using Castle.ActiveRecord;

namespace DecisionMaking.Domain
{
	[ActiveRecord]
	public class CandidateCueValue : ActiveRecordValidationBase<CandidateCueValue>
	{
		public CandidateCueValue ()
		{
		}
		
	    [PrimaryKey(PrimaryKeyType.Native)]
	    public int Id {set; get;}	
		
		[BelongsTo(NotNull = true, UniqueKey = "uix_candidate_cue_value")]
		public Candidate Candidate {set; get;}		

		[BelongsTo(NotNull = true, UniqueKey = "uix_candidate_cue_value")]
		public Cue Cue {set; get;}		
		
		[Property]
		public double Value {set; get;}
		
		public override bool Equals (object obj)
		{
			if (obj == null)
				return false;
			if (ReferenceEquals (this, obj))
				return true;
			if (obj.GetType () != typeof(CandidateCueValue))
				return false;
			CandidateCueValue other = (CandidateCueValue)obj;
			return Id == other.Id;
		}


		public override int GetHashCode ()
		{
			unchecked {
				return Id.GetHashCode ();
			}
		}

	}
}

